<template>
  <div>
    <goga-header :title="title">
      <div slot="left">
        <span @click="goBack">
          <icon symbol="back"> </icon>
        </span>
      </div>
    </goga-header>
    <img v-if="firstLoading" class="gxb-loading" src="../../assets/loding.gif" alt="">
    <div>
      <div class="empty" v-if="!getCate.can">
        <span>店铺获取失败</span>
      </div>
      <div class="shop-list" v-if="getCate.can">
        <router-link :to="{name:'shop',params: {shopId: item.warehouseSn}}" class="item bot-line" v-for="(item,index) in getCate.list" :key="index">
          <div class="p-pic"  v-lazy:background-image="'http://www.gogagoga.cc/picfile/'+item.wPic">
          </div>
          <div class="p-txt">
            <div class="p-tit">
              {{item.wName}}
            </div>
            <div class="p-other">
              {{item.wAddress}}
            </div>
            <div class="p-other">
              <span>起送￥68 </span>
              <span>{{item.rangeDetail}}</span>
            </div>
          </div>
        </router-link>
        <div class="list-complete" v-if="getCate.list.length>0">
          <img src="../../assets/min-logo.png" alt="">
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="babel">
  import {mapGetters} from 'vuex'
  import gogaHeader from '@components/goga-header'
  import Icon from '@components/icon'
  export default{
    components: {
      gogaHeader,
      Icon
    },
    data () {
      return {
        cateTitle: [
          '一周一果',
          '自选水果',
          '馈赠果盒',
          '没想稻',
          '瓯柑系列',
          '一周一花',
          '精品花束'
        ],
        firstLoading: true,
      }
    },
    computed: {
      ...mapGetters({
        getCate: 'backend/cate/getCate'
      }),
      title () {
        let cateId = this.$route.params.id;
        return this.cateTitle[cateId]
      }
    },
    async mounted() {
      await this.$store.dispatch('global/user/log');
      let cateId = this.$route.params.id;
      await this.$store.dispatch('backend/cate/getCate', cateId);
      this.firstLoading = false;
    },
    methods: {
      goBack() {
        this.$router.go(-1);
      }
    }
  }
</script>
<style lang="less">
  @import "index.less";
</style>
